<script type="text/javascript">
	rootURL = '<?php if(!strpos(CPortal::$root_url,'.') or strpos(CPortal::$root_url,'192.168.')!==false or strpos(CPortal::$root_url,'10.0.')!==false)echo CPortal::$root_url; else echo 'http://\'+location.hostname+((location.port==80 || !location.port)?\'\':\':\'+location.port)+\'/';?>';
	staticURL = '<?php echo CPortal::$static_url;?>';
</script>
<script type="text/javascript">
if(typeof(SYS) == 'undefined') {
	<?php if(defined('USE_LINKS_CACHE')):?>		
		document.write('<script type="text/javascript" src="{static_url}publish/<?php echo portal()->id;?>/page/jsGlobal.js?v=<?php echo JS_VERSION;?>"><'+'/script>');		
    <?php else: ?>
    	document.write('<script type="text/javascript" src="{static_url}3rdparty/jQuery/jquery-1.3.2.js"><'+'/script><script type="text/javascript" src="{static_url}lib/js/SYS/SYS.js"><'+'/script><script type="text/javascript" src="{static_url}lib/js/SYS/SYS.User.js"><'+'/script><script type="text/javascript" src="{static_url}3rdparty/jQuery/plugins/pureJSTemplate.js"><'+'/script><script type="text/javascript" src="{static_url}3rdparty/jQuery/plugins/jquery.cookie.js"><'+'/script><script type="text/javascript" src="{static_url}3rdparty/jQuery/plugins/jquery.json/jquery.json.min.js"><'+'/script><script type="text/javascript" src="{static_url}lib/js/SYS/SYS.Module.js"><'+'/script><script type="text/javascript" src="{static_url}lib/js/SYS/SYS.Form.js"><'+'/script><script type="text/javascript" src="{static_url}publish/{portal_id}/modules.js"><'+'/script>');
	<?php endif; ?>	
	initSYS = true;
}
</script>
<?php if(defined('USE_LINKS_CACHE') && !in_array(CPage::$current->name, CPage::$current->params['ignore_js'])):?>
<script type="text/javascript" src="{static_url}publish/<?php echo portal()->id;?>/page/<?php echo CPage::$current->name;?>.js?v=<?php echo JS_VERSION;?>"></script>
<?php endif; ?>
<script type="text/javascript">
$.extend(SYS,{
	modules:vhv_all_modules,
	version:'<?php echo JS_VERSION;?>',
	FILE_SERVER_URL:'<?php echo FILE_SERVER_URL;?>',
	isDebug:{is_debug},
	urlMode:'<?php echo CUrl::$mode;?>',
	portalId:'{portal_id}',
<?php if(portal()->id == 'estore' and request('estore_id')):?>
	estoreId:'<?php echo request('estore_id');?>',
	skin:'<?php echo portal()->skin('estore');?>',
<?php else: ?>
	skin:'<?php echo portal()->skin();?>',
<?php endif; ?>
	defaultPortalId:'{CPortal::$default}',
	exportUser:{portal()->setting('export-user')?1:0}
});
</script>
<script type="text/javascript">
	SYS.href = '?<?php echo $_SERVER['QUERY_STRING'];?>';
	SYS.init();
	<?php if(!portal()->setting('export-user')): ?>
	$.extend(SYS.User, {CString(user()->data)->json()});
	SYS.User.privileges = {CString(user()->privileges)->json()};
	SYS.User.modulePrivileges = {CString(user()->module_privileges)->json()};
	<?php endif; ?>
</script>
<?php echo '<script type="text/javascript">'.portal()->script.'</script>'; ?>
<?php
if(@$_SERVER['SERVER_NAME'] != 'localhost'): ?>
<script type="text/javascript">
SYS.ready = true;
$(window).bind("unload",function(){
	$(window).unbind();
});
</script>
<?php endif; ?>
<?php if(@DEBUG and @$_SERVER['HTTP_HOST'] != 'www.vimua.com' and !strpos(@$_SERVER['HTTP_USER_AGENT'], 'Firefox')): ?>
<!--<script type="text/javascript" src="{static_url}3rdparty/firebug/firebug-lite-compressed.js"></script> -->
<?php endif; ?>
</body>
</html>